home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / Tickle-4.0 (tcl) / tcl / extend / configure.in < prev    next >
Encoding:
Text File  |  1993-10-26  |  12.7 KB  |  360 lines  |  [TEXT/MPS ]

  1. dnl----------------------------------------------------------------------------
  2. dnl configure.in -
  3. dnl----------------------------------------------------------------------------
  4. dnl  This file is an input file used by the GNU "autoconf" program to
  5. dnl  generate the file "configure", which is run during Tcl installation
  6. dnl  to configure the system for the local environment.  Many of these
  7. dnl  checks are duplicates of those required by Tcl & Tk, since TclX
  8. dnl  includes there internal header files.
  9. dnl
  10. dnl  Although the generated configure script is under the GNU Public,
  11. dnl  License Extended Tcl remains freely redistributable for any purpose,
  12. dnl  including commercial use.
  13. dnl----------------------------------------------------------------------------
  14. dnl $Id: configure.in,v 1.7 1993/08/31 23:08:23 markd Exp $
  15. dnl----------------------------------------------------------------------------
  16.  
  17. AC_INIT(src/tclExtend.h)
  18. ifdef([AC_REVISION],AC_REVISION($Revision: 1.7 $),)dnl
  19.  
  20.  
  21. AC_CONFIG_HEADER(src/tclXconfig.h)
  22.  
  23. #------------------------------------------------------------------------------
  24. #     Check for various programs used during the build.
  25. #------------------------------------------------------------------------------
  26.  
  27. AC_PROG_YACC
  28. AC_PROG_CC
  29. AC_PROG_CPP
  30. AC_PROG_RANLIB
  31. AC_PROGRAM_CHECK(MCS_CMD, "mcs", [mcs -d], touch)
  32.  
  33. #------------------------------------------------------------------------------
  34. #       Some make programs require includes to be 
  35. #         .include "file"
  36. #     others...
  37. #         include file
  38. #------------------------------------------------------------------------------
  39.  
  40. echo checking how make handles includes
  41. rm -fr conftestdir
  42. if mkdir conftestdir; then
  43.   cd conftestdir
  44.   cat > Makeinclude <<EOF
  45.  
  46. EOF
  47.   cat > Makefile <<EOF
  48. include Makeinclude
  49.  
  50. all:
  51. EOF
  52.   if make >/dev/null 2>/dev/null; then
  53.     MAKEINCLUDE="include"
  54.     MAKEQUOTE=''
  55.   else
  56.     MAKEINCLUDE=".include"
  57.     MAKEQUOTE='"'
  58.   fi
  59.   cd ..
  60.   rm -fr conftestdir
  61. fi
  62. AC_SUBST(MAKEINCLUDE)
  63. AC_SUBST(MAKEQUOTE)
  64.  
  65.  
  66. #------------------------------------------------------------------------------
  67. #       If a system doesn't have an opendir function (man, that's old!)
  68. #       then we use the version of dirent.h Ouster supplied, which
  69. #       is compatible with the substitute version of opendir that's
  70. #       provided.  This version only works with V7-style directories.
  71. #------------------------------------------------------------------------------
  72.  
  73. AC_FUNC_CHECK(opendir, , AC_DEFINE(USE_DIRENT2_H))
  74.  
  75.  
  76. #------------------------------------------------------------------------------
  77. #       Do we have the catgets call (X/PG3 message catalogs)?
  78. #       Do we have the getcwd system call?
  79. #       Do we have the select system call?
  80. #       Do we have the setitimer system call?
  81. #       Do we have the setlinebuf call?
  82. #       Do we have the sigaction call?
  83. #       Do we have the getpgid call?
  84. #------------------------------------------------------------------------------
  85. AC_HAVE_FUNCS(catgets getcwd select setitimer setlinebuf)
  86. AC_HAVE_FUNCS(sigaction setpgid)
  87.  
  88.  
  89. #------------------------------------------------------------------------------
  90. #       Check for bzero.  We don't use bzero directly, but older SCO
  91. #       systems have a select FD_ZERO macro that calls bzero, which is
  92. #       only in the X library.  We redefine bzero as a memset call if
  93. #       there is no bzero.  If its not needed, it doesn't hurt
  94. #       anything.
  95. #------------------------------------------------------------------------------
  96. AC_HAVE_FUNCS(bzero)
  97.  
  98. #------------------------------------------------------------------------------
  99. #       Check for missing functions that we need.  They will be
  100. #       compiled in the osSupport directory. Must check for SCO
  101. #       -lintl, which is were strftime is hidden.
  102. #------------------------------------------------------------------------------
  103.  
  104. AC_SCO_INTL
  105. AC_FUNC_CHECK(strftime, ,[LIBOBJS="$LIBOBJS strftime.o"])
  106. AC_FUNC_CHECK(random, ,[LIBOBJS="$LIBOBJS random.o"])
  107. AC_SUBST(LIBOBJS)
  108.  
  109. #------------------------------------------------------------------------------
  110. #       Supply substitutes for missing POSIX header files.  Special
  111. #       notes:
  112. #           - Sprite's dirent.h exists but is bogus.
  113. #           - stdlib.h doesn't define strtol, strtoul, or
  114. #             strtod insome versions of SunOS
  115. #           - some versions of string.h don't declare procedures such
  116. #             as strstr
  117. #------------------------------------------------------------------------------
  118.  
  119. AC_UNISTD_H
  120. AC_COMPILE_CHECK(dirent.h, [#include <sys/types.h>
  121. #include <dirent.h>], [
  122. DIR *d;
  123. struct dirent *entryPtr;
  124. char *p;
  125. d = opendir("foobar");
  126. entryPtr = readdir(d);
  127. p = entryPtr->d_name;
  128. closedir(d);
  129. ], , AC_DEFINE(NO_DIRENT_H))
  130.  
  131. AC_HEADER_EGREP([Sprite version.* NOT POSIX], AC_DEFINE(NO_DIRENT_H))
  132. AC_HEADER_CHECK(float.h, , AC_DEFINE(NO_FLOAT_H))
  133. AC_HEADER_CHECK(values.h, , AC_DEFINE(NO_VALUES_H))
  134. AC_HEADER_CHECK(limits.h, , AC_DEFINE(NO_LIMITS_H))
  135. AC_HEADER_CHECK(stdlib.h, , AC_DEFINE(NO_STDLIB_H))
  136. AC_HEADER_EGREP(strtol, stdlib.h, , AC_DEFINE(NO_STDLIB_H))
  137. AC_HEADER_EGREP(strtoul, stdlib.h, , AC_DEFINE(NO_STDLIB_H))
  138. AC_HEADER_EGREP(strtod, stdlib.h, , AC_DEFINE(NO_STDLIB_H))
  139. AC_HEADER_CHECK(string.h, , AC_DEFINE(NO_STRING_H))
  140. AC_HEADER_EGREP(strstr, string.h, , AC_DEFINE(NO_STRING_H))
  141. AC_HEADER_EGREP(strerror, string.h, , AC_DEFINE(NO_STRING_H))
  142. AC_HEADER_CHECK(sys/time.h, , AC_DEFINE(NO_SYS_TIME_H))
  143. AC_HEADER_CHECK(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
  144. AC_HEADER_CHECK(sys/socket.h, , AC_DEFINE(NO_SYS_SOCKET_H))
  145.  
  146. #------------------------------------------------------------------------------
  147. #       Include sys/select.h if it exists and if it supplies things
  148. #       that appear to be useful.  This appears to be true only on
  149. #       the RS/6000 under AIX.  Some systems like OSF/1 have a
  150. #       sys/select.h that's of no use, and other systems like SCO
  151. #       UNIX have a sys/select.h that's pernicious.
  152. #------------------------------------------------------------------------------
  153.  
  154. echo checking for sys/select.h
  155. AC_HEADER_EGREP(fd_mask, sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H))
  156.  
  157. #------------------------------------------------------------------------------
  158. #       Check for missing typedefs.
  159. #------------------------------------------------------------------------------
  160.  
  161. AC_PID_T
  162. AC_GETGROUPS_T
  163. AC_UID_T
  164. AC_MODE_T
  165. AC_COMPILE_CHECK(time_t, [#include <sys/types.h>], , , AC_DEFINE(time_t, long))
  166.  
  167. #------------------------------------------------------------------------------
  168. #       Make "const" work no matter what.
  169. #------------------------------------------------------------------------------
  170.  
  171. AC_CONST
  172.  
  173. #------------------------------------------------------------------------------
  174. #       What type do signals return?
  175. #------------------------------------------------------------------------------
  176.  
  177. AC_RETSIGTYPE
  178.  
  179.  
  180. #------------------------------------------------------------------------------
  181. #       Find out all about time handling differences.
  182. #------------------------------------------------------------------------------
  183.  
  184. AC_TIME_WITH_SYS_TIME
  185. AC_TIMEZONE
  186.  
  187. AC_COMPILE_CHECK([tm_tzadj in struct tm], $decl,
  188. [struct tm tm; tm.tm_tzadj;], AC_DEFINE(HAVE_TM_TZADJ), )
  189.  
  190. AC_COMPILE_CHECK([tm_gmtoff in struct tm], $decl,
  191. [struct tm tm; tm.tm_gmtoff;], AC_DEFINE(HAVE_TM_GMTOFF), )
  192.  
  193. AC_HAVE_FUNCS(gettimeofday)
  194.  
  195. AC_COMPILE_CHECK([timezone variable], , [
  196. extern long timezone;
  197. timezone += 1;
  198. exit (0);
  199. ], AC_DEFINE(HAVE_TIMEZONE_VAR))
  200.  
  201. #------------------------------------------------------------------------------
  202. #     Test to see if "times" returns a status or the amount of
  203. #     elapsed real time.
  204. #------------------------------------------------------------------------------
  205.  
  206. echo "checking to see if 'times' returns the elapsed real time"
  207. AC_TEST_PROGRAM([
  208. #include <sys/types.h>
  209. #include <sys/times.h>
  210. main() {
  211. struct tms cpu;
  212. times (&cpu);
  213. sleep (2);
  214. if (times (&cpu) > 0)
  215.      exit (0);
  216. else 
  217.      exit (1);
  218. }
  219. ], AC_DEFINE(TIMES_RETS_REAL_TIME), )
  220.  
  221. #------------------------------------------------------------------------------
  222. #     Determine if "." is used as separator for the manual directory
  223. #     names.  i.e. man/man.1 vs man/man1
  224. #------------------------------------------------------------------------------
  225.  
  226. echo "checking man directory/section separator (man/man.1 vs man/man1)"
  227. mandirs="/usr/man/man.1 /usr/man/cat.1 /usr/share/man.1 /usr/share/man.1 
  228.         /usr/man/cat.C"
  229. gotdotdir="NO"
  230. for d in $mandirs
  231. do
  232.     if test -d $d
  233.     then
  234.         gotdotdir="YES"
  235.     fi
  236. done
  237.  
  238. mandirs="/usr/man/man1   /usr/man/cat1   /usr/share/man1   /usr/share/man1
  239.          /usr/man/man1.Z /usr/man/cat1.Z /usr/share/man1.Z /usr/share/man1.Z"
  240. gotnodotdir="NO"
  241. for d in $mandirs
  242. do
  243.     if test -d $d
  244.     then
  245.         gotnodotdir="YES"
  246.     fi
  247. done
  248.  
  249. if test $gotdotdir = YES -a $gotnodotdir = NO
  250. then
  251.     MAN_DIR_SEPARATOR="."
  252. elif test $gotdotdir = NO -a $gotnodotdir = YES
  253. then
  254.     MAN_DIR_SEPARATOR=""
  255. else
  256.     MAN_DIR_SEPARATOR="."
  257.     echo "WARNING: could not determine man directory/section separator"
  258.     echo "         assuming man/man.1 (can override in Config.mk)."
  259. fi
  260. AC_SUBST(MAN_DIR_SEPARATOR)
  261.  
  262. #------------------------------------------------------------------------------
  263. #       The check below checks whether <sys/wait.h> defines the type
  264. #       "union wait" correctly.  It's needed because of weirdness in
  265. #       HP-UX where "union wait" is defined in both the BSD and SYS-V
  266. #       environments.  Checking the usability of WIFEXITED seems to do
  267. #       the trick.
  268. #------------------------------------------------------------------------------
  269.  
  270. AC_COMPILE_CHECK([union wait], [#include <sys/types.h> 
  271. #include <sys/wait.h>], [
  272. union wait x;
  273. WIFEXITED(x);           /* Generates compiler error if WIFEXITED
  274.                          * uses an int. */
  275. ], , AC_DEFINE(NO_UNION_WAIT))
  276.  
  277. #------------------------------------------------------------------------------
  278. #       Add socket and nsl libraries, if found.  
  279. #       Use C shared library if possible.
  280. #------------------------------------------------------------------------------
  281.  
  282. AC_HAVE_LIBRARY(socket, [LIBS="$LIBS -lsocket"])
  283. AC_HAVE_LIBRARY(nsl, [LIBS="$LIBS -lnsl"])
  284. AC_HAVE_LIBRARY(c_s, [LIBS="$LIBS -lc_s"])
  285.  
  286. #------------------------------------------------------------------------------
  287. #       Locate the X11 header files and the X11 library archive.
  288. #------------------------------------------------------------------------------
  289.  
  290. echo checking for X11 header files
  291. XINCLUDES="# no special path needed"
  292. AC_TEST_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
  293. if test "$XINCLUDES" = nope; then
  294.     dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 /usr/openwin/include /usr/X11/include"
  295.     for i in $dirs ; do
  296.         if test -r $i/X11/Intrinsic.h; then
  297.             XINCLUDES=" -I$i"
  298.         fi
  299.     done
  300. fi
  301. if test "$XINCLUDES" = nope; then
  302.   echo "Warning:  couldn't find any X11 include files."
  303.   echo "          set XINCLUDES in Config.mk"
  304.   XINCLUDES="# no include files found"
  305. fi
  306. AC_SUBST(XINCLUDES)
  307.  
  308. echo "checking for X11 library archive"
  309. AC_HAVE_LIBRARY(X11_s, XLIBSW="-lX11_s")
  310. AC_HAVE_LIBRARY(libX11.a, XLIBSW="$XLIBSW -lX11", XLIBSW=nope)
  311. if test "$XLIBSW" = nope; then
  312.     dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/lib/X11R4 /usr/X11R5/lib /usr/lib/X11R5 /usr/openwin/lib /usr/X11/lib"
  313.     for i in $dirs ; do
  314.         if test -r $i/libX11_s.a; then
  315.             XLIBSW="-L$i -lX11_s"
  316.         elif test -r $i/libX11.a; then
  317.             XLIBSW="-L$i -lX11"
  318.         fi
  319.     done
  320. fi
  321. if test "$XLIBSW" = nope ; then
  322.     AC_HAVE_LIBRARY(libXwindow.a, XLIBSW=-lXwindow)
  323. fi
  324. if test "$XLIBSW" = nope ; then
  325.     echo "Warning:  couldn't find the X11 library archive.  Using -lX11."
  326.     XLIBSW=-lX11
  327. fi
  328. AC_SUBST(XLIBSW)
  329.  
  330. #------------------------------------------------------------------------------
  331. #       The code below cleans up the DEFS variable to eliminate
  332. #       duplicate entries.  This makes the eventual make output
  333. #       look a bit cleaner.
  334. #------------------------------------------------------------------------------
  335.  
  336. newDefs=""
  337. for i in $DEFS; do
  338.     if test -z "$newDefs"; then
  339.         newDefs=$i
  340.     elif echo $newDefs | fgrep -v -e $i >/dev/null 2>&1; then
  341.         newDefs="$newDefs $i"
  342.     fi
  343. done
  344. DEFS=$newDefs
  345.  
  346. #------------------------------------------------------------------------------
  347. # Define srcbasedir and bldbasedir as absolute paths.
  348. #------------------------------------------------------------------------------
  349.  
  350. srcbasedir=`cd $srcdir;pwd`
  351. AC_SUBST(srcbasedir)
  352. bldbasedir=`pwd`
  353. AC_SUBST(bldbasedir)
  354.  
  355. #------------------------------------------------------------------------------
  356. # Generate the make files.
  357. #------------------------------------------------------------------------------
  358.  
  359. AC_OUTPUT(Makefile osSupport/Makefile src/Makefile tclsrc/Makefile tksrc/Makefile tktclsrc/Makefile tools/Makefile)
  360.